package com.neuedu.ssm.service.impl;

import com.neuedu.ssm.mapper.DeptMapper;
import com.neuedu.ssm.po.Dept;
import com.neuedu.ssm.service.IDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 金山
 * 项目：springmvc-learn
 * site: https://blog.fulfill.com.cn
 * 描述
 * @data 2025/3/1814:47
 */
@Service
public class UserServiceImpl implements IDeptService {

    @Autowired
    private DeptMapper deptMapper;


    @Override
    public Dept getById(long id) {
        return deptMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Dept> list() {
        return deptMapper.selectList();
    }

    @Override
    public boolean save(Dept dept) {
        return deptMapper.insertSelective(dept)>0;
    }

    @Override
    public boolean update(Dept dept) {
        return   deptMapper.updateByPrimaryKeySelective(dept)>0;

    }

    @Override
    public boolean delete(long id) {
        return deptMapper.deleteByPrimaryKey(id) >0;
    }
}
